<?php

 function  Print_student($all_student_information){
    
    
        import("Org.Util.PHPExcel");
        import("Org.Util.PHPExcel.Writer.Excel2007");
        import("Org.Util.PHPExcel.Writer.Excel5");
        import("Org.Util.PHPExcel.IOFactory");
        
        $objPHPExcel = new \PHPExcel();
        $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.'1','编号')
                                           ->setCellValue('B'.'1','学号')
                                            ->setCellValue('C'.'1','姓名')
                                             ->setCellValue('D'.'1','项目名');
                                           
                                          
                                           


        $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('A')->setAutoSize(10);
        $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('B')->setAutoSize(15);
        $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('C')->setAutoSize(10);
         $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('D')->setAutoSize(20);
      
   
        


     
      
         foreach($all_student_information as $k => $v){
            
            $num=$k+2;
            switch ($v['isbid']){
                case 0: $isbid = "不招标"; break;
                case 1: $isbid = "招标中"; break;
                case 2: $isbid = "停止招标"; break;
            }
            switch ($v['ischecked']){
                case 0: $ischecked = "未审核"; break;
                case 1: $ischecked = "审核通过"; break;
                case 2: $ischecked = "审核未通过"; break;
            }
            $objPHPExcel->setActiveSheetIndex(0) 
                        ->setCellValue('A'.$num, $num-1)

                        ->setCellValue('B'.$num, $v['stunum'])
                        ->setCellValue('C'.$num, $v['realname'])
                         ->setCellValue('D'.$num, $v['name']);                      
                        
                         
                          
                  
                  
                        

       

}
 $this_time = date('Y-m-d', time());
        $objPHPExcel->getActiveSheet()->setTitle("$this_time");
        $objPHPExcel->setActiveSheetIndex(0);
        header('Content-Type: application/vnd.ms-excel');
        header('Content-Disposition: attachment;filename="'.$this_time._全部导出数据.'.xls"');
        header('Cache-Control: max-age=0');
        ob_clean();
        flush();

        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save('php://output');
        exit;
    
}
?>